<template>
    <div class="pagination">
        <el-pagination background class="custom-pagination" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" :current-page.sync="paginationData.currentPage"
            :page-sizes="[10, 20, 30, 40]" :page-size="paginationData.pageSize"
            layout="total, sizes, prev, pager, next, jumper" :total="paginationData.totals">
        </el-pagination>
    </div>
</template>
<script>
// import {mapState} from 'vuex'
export default {
    name: 'Pagination',
    components: {

    },
    mixins: [],
    props: ['paginationData'],
    data() {
        return {
            currentPage: 1,
            pageSize: 10,
            type: null
        }
    },
    computed: {
        // ...mapState('paginationStore',['currentPage','pageSize'])
    },
    watch: {

    },
    mounted() {
        this.getType()
    },
    methods: {
        handleSizeChange(pagesize) {
            this.pageSize = pagesize
            const obj = {
                pageSize: pagesize,
                currentPage: this.currentPage,
                type: this.type
            }
            this.$emit('getPaginationData', obj)
        },
        handleCurrentChange(currentpage) {
            this.currentPage = currentpage
            const obj = {
                pageSize: this.pageSize,
                currentPage: currentpage,
                type: this.type
            }
            this.$emit('getPaginationData', obj)
        },
        getType() {
            if (this.$route.fullPath == '/information') {
                this.type = 0
            } else if (this.$route.fullPath == '/policy') {
                this.type = 1
            }
        }
    }
};
</script>
<style lang='less' scoped>
.pagination {
    padding-top: 10px;


}
</style>